//--------------------------------------------------------------------------
// 
//  Copyright (c) Chili Software.  All rights reserved. 
// 
//  File: SearcherField.cs
//
//  Description: Represents a single searcher field.
// 
//--------------------------------------------------------------------------

using System;
using System.Collections.Generic;
using System.Text;
using Chili.Opf3.Wizard.Shared.Storages;

namespace Chili.Opf3.Wizard.CSharp.Searcher
{
	/// <summary>
	/// Holds a single searcher field.
	/// </summary>
	public class SearcherField
	{
		private Field _field;
		private string _comparer;

		/// <summary>
		/// Creates a new instance of the <see cref="SearcherField">SearcherField Class</see>.
		/// </summary>
		/// <param name="field">The field associated with the class.</param>
		/// <param name="comparer">The comparer used in the search query.</param>
		public SearcherField(Field field, string comparer)
		{
			if (field == null)
				throw new ArgumentNullException("field");
			if (comparer == null)
				throw new ArgumentNullException("comparer");

			_field = field;
			_comparer = comparer;
		}

		/// <summary>
		/// Gets the associated field.
		/// </summary>
		public Field Field
		{
			get { return _field; }
		}

		/// <summary>
		/// Gets the comparer used in the search query.
		/// </summary>
		public string Comparer
		{
			get { return _comparer; }
		}

		/// <summary>
		/// Gets a string representation of the object.
		/// </summary>
		/// <returns></returns>
		public override string ToString()
		{
			return this.Field.PropertyName + " (" + this.Comparer + ")";
		}
	}
}
